package com.vlong.town.service.collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.vlong.town.entity.collection.Collection;
import com.vlong.town.mapper.collection.CollectionMapper;
/**
 * 收藏实现类
 */
@Service
public class CollectionService {

	@Autowired
	private  CollectionMapper  collectionMapper;
	
	/**
	 * 添加收藏
	 * @param collectionId
	 * @param orgId
	 * @param state
	 * @param status
	 * @param userId
	 * @param wxId
	 * @param type
	 * @param dataId
	 * @param createTime
	 */
	@Transactional
	public  void  addCollection(Long collectionId,Long orgId,Integer state,Integer status,Long userId,String wxId,Integer  type,Long dataId,Long createTime){
		Collection  collection=new  Collection();
		collection.setCollectionId(collectionId);
		collection.setOrgId(orgId);
		collection.setState(state);
		collection.setStatus(status);
		collection.setUserId(userId);
		collection.setWxId(wxId);
		collection.setType(type);
		collection.setDataId(dataId);
		collection.setCreateTime(createTime);
		collectionMapper.addCollection(collection);
	}
	
	/**
	 * 根据微信id查询收藏
	 * @param wxId
	 * @return Collection
	 */
	@Transactional(readOnly = true)
	public Collection  queryByWxId(String wxId){
		return  collectionMapper.selectByWxId(wxId);
	}
	
	
	
}
